package com.mxpio.webapp.service.impl;

import com.mxpio.webapp.entity.MonitorSsh;
import com.mxpio.webapp.service.IMonitorSshService;
import com.mxpioframework.jpa.JpaUtil;
import com.mxpioframework.jpa.initiator.JpaUtilAble;
import com.mxpioframework.jpa.query.Criteria;
import org.springframework.context.ApplicationContext;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author: Cheng
 * @date: 2022/11/13
 */
@Service
public class MonitorSshServiceImpl implements IMonitorSshService, JpaUtilAble {

    @Override
    @Transactional(readOnly = true)
    public MonitorSsh selectById(String id) {
        return JpaUtil.linq(MonitorSsh.class).idEqual(id).findOne();
    }

    @Override
    @Transactional(readOnly = true)
    public Page<MonitorSsh> queryAll(Criteria criteria, Pageable pageable) {
        return JpaUtil.linq(MonitorSsh.class).where(criteria).paging(pageable);
    }


    @Override
    @Transactional(readOnly = false)
    public MonitorSsh save(MonitorSsh monitorSsh) {
        JpaUtil.save(monitorSsh);
        return monitorSsh;
    }

    @Override
    @Transactional(readOnly = false)
    public MonitorSsh update(MonitorSsh monitorSsh) {
        JpaUtil.update(monitorSsh);
        return monitorSsh;
    }

    @Override
    @Transactional(readOnly = false)
    public void delete(List<String> ids) {
        JpaUtil.lind(MonitorSsh.class).in("id", ids).delete();
    }

    @Override
    public void afterPropertiesSet(ApplicationContext applicationContext) {

    }
}
